/******************************************************************/ 	
/*     	File Name:		PS_models.do		   					  */
/*     	Date:   		September 22, 2021						  */
/*      Input File:		PS_data.dta							  	  */
/******************************************************************/

use "PS_Trump.dta"

log using PS_TrumpRallies.log, replace

/* Full Sample */
nbreg n_hatecrim rallyL  percent_urban bermanest_percap number_hate violent_crime_percap10k property_crime_percap10k percent_rep_pres12 college south northeast midwest jan feb mar apr may jun jul aug sep oc dec, cluster(stcoufips)
prvalue, x(rallyL=0) rest(mean) save
prvalue, x(rallyL=1) rest(mean) diff

nbreg n_hatecrim rallyL      percent_urban bermanest_percap number_hate violent_crime_percap10k property_crime_percap10k percent_rep_pres12 college south northeast midwest jan feb mar apr may jun jul aug sep oc dec, cluster(stcoufips) irr
gen sample=1 if e(sample)
eststo lagged
prvalue, x(rallyL=0) rest(mean) save
prvalue, x(rallyL=1) rest(mean) diff
gen pipe = "|"


/* Matched Models */
nbreg n_hatecrim rallyL percent_urban bermanest_percap number_hate violent_crime_percap10k property_crime_percap10k percent_rep_pres12 college south northeast midwest jan feb mar apr may jun jul aug sep oc dec [iweight=cem_weights], cluster(stcoufips) 
prvalue, x(rallyL=0) rest(mean) save
prvalue, x(rallyL=1) rest(mean) diff

nbreg n_hatecrim rallyL percent_urban bermanest_percap number_hate violent_crime_percap10k property_crime_percap10k percent_rep_pres12 college south northeast midwest jan feb mar apr may jun jul aug sep oc dec [iweight=cem_weights], cluster(stcoufips) irr
prvalue, x(rallyL=0) rest(mean) save
prvalue, x(rallyL=1) rest(mean) diff


/* Appendix */
/* Table A */
nbreg n_hatecrim postrally2 percent_urban bermanest_percap number_hate violent_crime_percap10k property_crime_percap10k percent_rep_pres12 college south northeast midwest jan feb mar apr may jun jul aug sep oc dec, cluster(stcoufips) 
prvalue, x(postrally2=0) rest(mean) save
prvalue, x(postrally2=1) rest(mean) diff

nbreg n_hatecrim postrally2 percent_urban bermanest_percap number_hate violent_crime_percap10k property_crime_percap10k percent_rep_pres12 college south northeast midwest jan feb mar apr may jun jul aug sep oc dec, cluster(stcoufips) irr
prvalue, x(postrally2=0) rest(mean) save
prvalue, x(postrally2=1) rest(mean) diff

nbreg n_hatecrim rallyt2      percent_urban bermanest_percap number_hate violent_crime_percap10k property_crime_percap10k percent_rep_pres12 college south northeast midwest jan feb mar apr may jun jul aug sep oc dec, cluster(stcoufips)
prvalue, x(rallyt2=0) rest(mean) save
prvalue, x(rallyt2=1) rest(mean) diff

nbreg n_hatecrim rallyt2      percent_urban bermanest_percap number_hate violent_crime_percap10k property_crime_percap10k percent_rep_pres12 college south northeast midwest jan feb mar apr may jun jul aug sep oc dec, cluster(stcoufips) irr
prvalue, x(rallyt2=0) rest(mean) save
prvalue, x(rallyt2=1) rest(mean) diff

/* Table B */
logit rally percent_urban n_hatecrim bermanest_percap number_hate violent_crime_percap10k property_crime_percap10k percent_rep_pres12 college south northeast midwest jan feb mar apr may jun jul aug sep oc, cluster(stcoufips) 

log close
